export default {
	install(Vue) {
		/**
			this.$confirm('xxxx', '提示').then(()=>{
				console.log('then');
			}).catch(()=>{
				console.log('catch');
			})
		 */
		Vue.$confirm = Vue.prototype.$confirm = (content, title = '提示', opt) =>
			new Promise((resolve, reject) => {
				uni.showModal({
					title,
					content,
					success(res) {
						if (res.confirm) {
							resolve()
						} else if (res.cancel) {
							reject()
						}
					},
					fail: reject,
					...opt
				})
			})
		Vue.$confirm.delete = Vue.prototype.$confirm.delete = opt =>
			Vue.prototype.$confirm('您确定要删除吗？', '提示', opt)
	}
}